// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently, but
// are changed infrequently
//

#pragma once
#include <stdio.h>
#include <vector>
#include <string>
#include <iostream>
#include <fstream>
#include <ctype.h>
using namespace std;

const bool MERGE_ALL_ISOFORMS_WITH_THE_SAME_INNTER_EXONS = false;
const bool TEST = false;
const int MAX_MRNA_SIZE = 100000;
const int MIN_MRNA_SIZE = 300;
const int MAX_LINE = 2048;

// Change the log level to see different level of information.
#define LOG_LEVEL 3
#define WARNING_LOG 4
#define INFO_LOG 3
#define CONFIG_LOG 2
#define FINE_LOG 1

#ifdef LOG_LEVEL
#ifdef WIN32
//#define LOG_INFO printf
#define LOG_INFO(format, level, ...) {\
    if(level >= LOG_LEVEL) {\
        if(level >= LOG_LEVEL) {\
            printf(format, level, __VA_ARGS__);\
        }\
    }\
}
#else
#define LOG_INFO(format, level, args...) {\
    if(level >= LOG_LEVEL) {\
        if(level >= LOG_LEVEL) {\
            printf("%s, %d (%s)\n", __FILE__, __LINE__, __FUNCTION__);\
            printf(format, level, ##args);\
        }\
    }\
}
#endif
#endif
#define TIME_INFORMATION(a) {\
        time_t startt, endt;\
        time(&startt);\
        a;\
        time(&endt);\
        printf("%u seconds consumed.\t\t\t\r", (unsigned int)(endt - startt));\
    }

#define TIME_INFO(a, msg) {\
        time_t startt, endt;\
        time(&startt);\
        a;\
        time(&endt);\
        printf("%s uses %u seconds.\t\t\t\r", msg, (unsigned int)(endt - startt));\
    }

#define TIME {\
        time_t t;\
        time(&t);\
        printf("\nThe current local time is: %s", ctime(&t));\
    }

#define ERR printf("ERR --- %s:%d\n", __FILE__, __LINE__);
#define ASSERT_TRUE(expression, message)\
    do {\
        if (!(expression))\
        { \
            printf("ERROR: %s.  Press ENTER to continue", message);\
            char crap[256];\
            cin.getline(crap, 256);\
        }\
    } while(0)

#define ASSERT_EQUAL(expectation, real_value, message)\
	do {\
		if (expectation != real_value) {\
			cout << '\n' << expectation << " is not equal to " << real_value << endl;\
            printf("ERROR: %s.  Press ENTER to continue", message);\
            char crap[256];\
            cin.getline(crap, 256);\
        }\
    } while(0)

inline bool assert_int_equal(int ExpValue, int trueValue)
{
    ASSERT_EQUAL(ExpValue, trueValue, "");
    if (ExpValue != trueValue)
        return(false);
    else
        return(true);
}

string trim(string str, char sep = ' ');

//Counter for total coverage in base pair
#ifdef WIN32
#define printInfo printf
#else
#define printInfo(format, args...) printf("%s:%d (%s)\t" format, __FILE__, __LINE__, __FUNCTION__, ##args)
#endif
void Tokenize(const string& str, vector<string>& tokens, const string& delimiters = " ");
